package com.yc.system.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yc.system.entity.Color;
import com.yc.system.mapper.ColorMapper;
import com.yc.system.service.IColorService;
import com.yc.framework.baseClass.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.yc.framework.baseClass.R;


/**
 * <p>
 * 颜色 服务实现类
 * </p>
 *
 * @author 1850140986@qq.com
 * @since 2022-12-06
 */

@Service
public class ColorServiceImpl extends BaseServiceImpl<ColorMapper,Color> implements IColorService {

    /**
    * 分页查询实体列表
    * @param model 查询参数
    * @return 查询结果
    */
    @Override
    public R list( Color model){
        IPage<Color> page = new Page<>(model.getPageNum(),model.getPageSize());
        QueryWrapper<Color> wrapper = new QueryWrapper<>();
         initCondition(wrapper);
        setParam(wrapper,model);
         IPage<Color> px = page(page,wrapper);
        return R.ok().put("data",px.getRecords()).put("total", px.getTotal());
    }

    /**
    * 根据主键删除实体对象，返回值封装成R，若成功则会把要删除的主键计入返回的R
    *
    * @param id 主键
    * @return 删除是否成功
   
    @Override
    public R removeModelById(String id){
        Color model=new Color();
        model.setId(id);
        return removeModelById(model);
    }
 */
    public  void setParam(QueryWrapper<Color> wrapper, Color model) {
        if (model == null) {
        return;
        }
       // wrapper.eq("deleted", false);
    }
}
